# -*- coding: utf-8 -*-
from re_utils import re_anonymize_need,scan_files, exts, dir_path
import time

def scan_file(file_path):
    time1 = time.time()
    bool_flag = False
    with open(file_path, 'r', encoding='utf-8') as infile:
        for line in infile:
            re_text = re_anonymize_need(line)
            if re_text != line:
                print("存在敏感信息: ", re_text)
                bool_flag = True
                break
    if bool_flag is not True:
        print("扫描完毕，不存在敏感信息，耗时 ", (time.time() - time1))


if __name__ == '__main__':

    # 备份日志的后缀
    file_path = r'E:\杂物\server.log'
    scan_file(file_path)
